package com.hj.aiagent.core.flow.model;

import lombok.Data;

import java.util.List;

/**
 * 执行计划
 */
@Data
public class Plan {
    private String id;
    private String originalGoal;
    private List<PlanStep> steps;
    private PlanStatus status = PlanStatus.CREATED;
    private int currentStepIndex = 0;
    private String summary;       // 计划总结
    
    public Plan(String id, String originalGoal) {
        this.id = id;
        this.originalGoal = originalGoal;
    }
    
    public PlanStep getCurrentStep() {
        if (currentStepIndex < steps.size()) {
            return steps.get(currentStepIndex);
        }
        return null;
    }
    
    public void moveToNextStep() {
        if (currentStepIndex < steps.size()) {
            currentStepIndex++;
        }
    }
    
    public boolean isCompleted() {
        return currentStepIndex >= steps.size() || 
               steps.stream().allMatch(s -> s.getStatus() == StepStatus.COMPLETED || s.getStatus() == StepStatus.SKIPPED);
    }
}